const enterpriseVue = new Vue({
  el: '#app',
  data() {
    return {
      pickerOptions: pickerOptions,
      tableData: [],
      rules: {
        AppID_Path_Name: [{
          required: true,
          message: '请输入路径名称',
          trigger: 'blur',
        }],
        AppID_Path: [{
          required: true,
          message: '请输入路径',
          trigger: 'blur',
        }]
      },
      form: {
        AppID_Path: '',
        AppID_Path_Name: "",
        AppID_Path_Type: "0",
      },
      loading: false,
      list: [],
    }
  },
  mounted() {
  },
  methods: {
    submitForm(formName) {
      let _this = this
      console.log(_this.form);
      _this.$refs[formName].validate((valid) => {
        if (valid) {
          _this.loading = true
          $.ajax({
            url: DomainName + '/getAddAction',
            type: 'POST',
            data: {
              Data: JSON.stringify({
                enterprise_appid_path: [_this.form]
              }),
              token: $.cookie("token")
            },
            success: function (res) {
              if (res.Result == "成功") {
                _this.$message({
                  message: '提交成功',
                  type: 'success'
                });
                window.location.href = './address.html'
                // window.location.href = 'index.html';
              } else {
                _this.$message.error(res.Result);
              }
            },
            error: function () {
              console.log(error)
            },
            complete: function (XMLHttpRequest) {
              _this.loading = false
              if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
              }
            }
          })
        }
        else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    },
  }
})